package com.ia.aistream.manager.framework.redis;

/**
 * 定义存放CAD数据的key
 * @Author xiaoyu
 * @create 2020/12/9 10:29
 */
public enum KeyFiled {
    /***
     * 操作用户的ID
     */
    CAD_USER_ID("CAD_USER_ID"),
    /***
     * dwg文件中的索引信息
     */
    CAD_DWG_INDEX("CAD_DWG_INDEX"),
    /***
     * dwg文件的设备信息
     */
    CAD_DWG_IMG_COMPONENT("CAD_DWG_IMG_COMPONENT")
    ;
    public String value;
    KeyFiled(String value){
        this.value = value;
    }

    public String getKey(Object... keys) {
        if (keys == null || keys.length == 0) {
            return name().toLowerCase().replace("_", ":");
        }

        StringBuilder prefix = new StringBuilder(name().toLowerCase().replace("_", ":")).append(":");
        for (Object key : keys) {
            prefix.append(key).append("_");
        }

        prefix.setLength(prefix.length() - 1);
        return prefix.toString();
    }
}
